<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

function generateRandStr($length) {
    $pool = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $max = strlen($pool) - 1;
    $randStr = '';
    for ($i = 0; $i < $length; $i++) {
        $randStr .= $pool[rand(0, $max)];
    }
    return $randStr;
}

function trimStr($str) {
    $str = preg_replace('/^(&nbsp;|\s)*|(&nbsp;|\s)*$/', '', $str);
    return $str;
}